package com.etc.controllers;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;


import javax.annotation.Resource;
import java.util.Map;
import java.util.Set;

@RestController
public class GetRedisController {

    @Resource(name="redisTemplate")
    RedisTemplate template;


    @GetMapping("hash/get")
    public String getVlue() {


        HashOperations<String, String, Object> opshm = template.opsForHash();
        Map map = opshm.entries("myobject");
        System.out.println(template.opsForValue().get("mykey1"));
        Set s = opshm.keys("*");
        s.forEach(a -> {
            System.out.println(s);
        });

        map.forEach((k, v) -> {
            System.out.println(k + "@" + v);
        });

        return "aaa";
    }
}
